#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

void print1(std::vector<std::string> &str)
{
    for(auto it : str)
    {
        std::cout << it << " ";
    }
    std::cout << std::endl;
}

/**
 * @brief 排序文本，是每个单词只出现一次
 * 
 * @param words 
 */
void elimDups(std::vector<std::string> &words)
{
    std::sort(words.begin(), words.end());
    print1(words);
    auto end_unique = std::unique(words.begin(), words.end());
    print1(words);
    words.erase(end_unique, words.end());
    print1(words);
}

int main()
{
    std::vector<std::string> str1 = {"the","quick","red","fox","jumps","over","the","slow","red","turtle"};
    elimDups(str1);
    return 0;
}
